home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1997 August / Walnut Creek CDROM.7z / LISTINGS / V_13_07 / ROSS.ZIP / SSFIND.C < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-02  |  321 b   |  16 lines

  1. #include <stdio.h>
  2. #include <string.h>
  3. int ssFind(int n, char *txt, int m, char *pat)
  4. { int nmatch = 0;
  5.   char *cp;
  6.   cp = txt;
  7.   while (cp = strstr(cp, pat))
  8.   { printf("%d\n",cp-txt);
  9.     nmatch++;
  10.     cp++;
  11.   }
  12.   return(nmatch);
  13. }
  14. Figure 4. String searching function using C library function strstr().
  15.  
  16.